ZCF-3300 <feature>[license]: support license lsclient#3893
ZCF-3300 <feature>[license]: support license lsclient#3893zstack-robot-1 wants to merge 2 commits intofeature-5.5.22-zcf-temporaryfrom
Conversation
Support testlib simulator routing and multipart parsing for License Server client API tests. Resolves: ZCF-3300 Change-Id: I4a80faaf48aa174bebc5186b8b76033a9b6968b7
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Walkthrough该PR为TestLibController扩展路由并在控制器层检测并短路multipart请求;EnvSpec新增multipart感知的请求体读取与序列化,并调整getEntityFromRequest的头部/体构建顺序。 多部分请求处理
Sequence Diagram(s)sequenceDiagram
participant Client
participant TestLibController
participant TestHandler
participant EnvSpec
participant AsyncHandler
Client->>TestLibController: HTTP request
TestLibController->>TestLibController: isMultipartRequest?
alt multipart
TestLibController->>TestHandler: Test.handleHttp(request,response)
TestHandler-->>Client: response
else non-multipart
TestLibController->>AsyncHandler: enqueue async handling
AsyncHandler->>EnvSpec: getEntityFromRequest(req)
EnvSpec->>EnvSpec: collect headers
EnvSpec->>EnvSpec: read body (multipart? -> multipart reader : reader lines)
EnvSpec-->>AsyncHandler: HttpEntity<String>
AsyncHandler-->>Client: response
end
代码审查工作量估计🎯 3 (中等复杂度) | ⏱️ ~22 分钟 庆祝诗
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@testlib/src/main/java/org/zstack/testlib/EnvSpec.groovy`:
- Around line 1001-1006: The code repeatedly calls req.getReader() causing
potential inconsistent reads; change to obtain a single BufferedReader reader =
req.getReader() (or def reader) before the loop, use that reader in the while
loop that appends lines (instead of calling req.getReader().readLine()), and
ensure the reader is closed in a finally block (or try-with-resources) to
guarantee a single, safe close; update the block around the loop in
EnvSpec.groovy where String line is used so all read/close operations reference
this single reader variable.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: http://open.zstack.ai:20001/code-reviews/zstack-cloud.yaml (via .coderabbit.yaml)
Review profile: CHILL
Plan: Pro
Run ID: a0e468ad-d803-4c32-9c4d-87a474a162a0
📒 Files selected for processing (2)
testlib/src/main/java/org/zstack/testlib/EnvSpec.groovytestlib/src/main/java/org/zstack/testlib/TestLibController.java
Resolves: ZCF-3300 Change-Id: Ice0313a96e9c4c72adbd9d2f6f52e832fe590bbc
Summary
/v1/sites/**and/v1/quota/**.Jira
Verification
sync from gitlab !9775